package com.qianfeng.dbsm.controller;

import com.qianfeng.dbsm.common.ResponseData;
import com.qianfeng.dbsm.service.ExpressService;
import com.qianfeng.dbsm.vo.OrderQueryParamVo;
import com.qianfeng.dbsm.vo.OrderVo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 物流查询相关的controller
 */
@RestController
@RequestMapping("express")
public class ExpressController {

    @Autowired
    private ExpressService expressService;

    @ApiOperation(value = "1-1物流查询接口-通过订单编号", notes = "通过订单编号查询该订单的物流情况！！！")
    @GetMapping("queryExpressByOrderNumber")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "orderNumber",value = "订单编号",dataType = "String")
    })
    public ResponseData queryExpressByOrderNumber(String orderNumber){
        ResponseData rd = new ResponseData();
        Object reslut = expressService.queryExpressByOrderNumber(orderNumber);
        rd.setCode(20000);
        rd.setMessage("查询成功");
        rd.setData(reslut);
        return rd;
    }
    @ApiOperation(value = "1-2物流查询接口-通过快递单号", notes = "通过快递编号查询该订单的物流情况！！！")
    @GetMapping("queryExpressByExpress")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "expressNumber",value = "快递单号",dataType = "String"),
            @ApiImplicitParam(name = "expressCode",value = "快递公司编码 SF:顺丰速运 HTKY:百世快递 ZTO:中通快递 STO:申通快递 YTO:圆通速递 YD:韵达速递 YZPY:邮政快递包裹 (例如顺丰填：SF)",dataType = "String"),
            @ApiImplicitParam(name = "customerName",value = "收件人姓名（顺丰快递必须填写收件人姓名，其他快递为空）",dataType = "String"),
    })
    public ResponseData queryExpressByExpress(String expressNumber,String expressCode,String customerName){
        ResponseData rd = new ResponseData();
        Object reslut = expressService.queryExpressByExpress(expressNumber,expressCode,customerName);
        rd.setCode(20000);
        rd.setMessage("查询成功");
        rd.setData(reslut);
        return rd;
    }

}
